Skip to content

fix: preserve full screen state when quitting from a full screen window#1089

Closed
datlechin wants to merge 3 commits intomainfrom
fix/window-state-fullscreen-on-quit
Closed

fix: preserve full screen state when quitting from a full screen window#1089
datlechin wants to merge 3 commits intomainfrom
fix/window-state-fullscreen-on-quit

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

  • Quitting the app while an editor window is in full screen now correctly restores full screen on next launch.
  • Previously, AppKit's implicit fullscreen-exit during app termination fired didExitFullScreenNotification, which our observer interpreted as the user explicitly leaving full screen and wrote false to the persisted bool.

Why

Reproduces every time after #1083 merged: enter full screen, Cmd+Q, relaunch, connect — window opens at the small pre-fullscreen frame in the top-left, never in full screen.

Root cause: setFrameAutosaveName saves the regular frame (not the fullscreen frame), and our didExitFullScreen observer fired during quit, resetting the persisted full-screen flag to false. So both signals were lost.

How

Two-part fix in WindowStateController:

  1. Observe NSApplication.willTerminateNotification. At terminate, set isTerminating = true and snapshot every live binding's current full-screen state (window.styleMask.contains(.fullScreen)) to UserDefaults. This captures the truth at the moment of quit, before AppKit's auto-exit animation runs.
  2. The didExitFullScreen observer now checks owner.isTerminating and skips the false write during termination. Real user-initiated exits (green button, Esc) still update the bool correctly.

Test plan

  • Launch the app, connect to a database, enter full screen, Cmd+Q. Relaunch and connect: window opens in full screen.
  • Same flow but exit full screen with the green button before quitting. Relaunch: window opens at the regular pre-fullscreen frame.
  • First launch ever (no prior state): window opens at the first-run computed size, not full screen.
  • Open multiple connection windows in a tab group, enter full screen on the group, Cmd+Q. Relaunch: tab group opens in full screen.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin datlechin closed this May 7, 2026
@datlechin datlechin deleted the fix/window-state-fullscreen-on-quit branch May 7, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant